package dome2;


public class Animal implements Cloneable {
    public String name;
    public Money money;
    public Animal(String name) {
        this.name = name;
        this.money = new Money();
    }

    @Override
    protected Object clone()
            throws CloneNotSupportedException {
        //return super.clone();
        Animal tmp = (Animal) super.clone();
        tmp.money = (Money)this.money.clone();
        return tmp;
    }

    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", money=" + money +
                '}';
    }
}
